package com.itic.mall.mobile.project;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.itic.appbase.framework.type.AfterSaleType;
import com.itic.mall.mobile.base.BaseMobileInterface;

@Controller
@RequestMapping(value="/mobile/project/descript")
public class ProjectDescriptInterface  extends BaseMobileInterface{
	
	@RequestMapping(value="afterSaleReason")
	@ResponseBody
	public Map<String, Object> afterSaleReason(HttpServletResponse response,String type){
		Map<String, Object> resultMap = new HashMap<>();
		String errorCode = PARAM_ERROR_CODE;
		String errorMsg = PARAM_ERROR_MSG;
		try {
			if(StringUtils.isNotEmpty(type)) {
				AfterSaleType afterSaleType = AfterSaleType.getType(type);
				List<String> reasons = this.getDescribeType(afterSaleType.getState());
				resultMap.put(DATA, reasons);
				errorCode = SUCCESS_ERROR_CODE;
				errorMsg = SUCCESS_ERROR_MSG;
			}
		} catch (Exception e) {
			errorCode = SERVER_ERROR_CODE;
			errorMsg = SERVER_ERROR_MSG;
			logException("ProjectDescriptInterface", "afterSaleReason", e.toString(), "售后原因", e);
		}
		resultMap.put(CODE, errorCode);
		resultMap.put(MSG, errorMsg);
		isCrrossDomain(response);
		return resultMap;
		
	}
	
	
}
